@extends('layouts.master')
@section('content') 
<div class="row">
	<div id="breadcrumb" class="col-md-12">
		<ol class="breadcrumb">
			<li><a href="#">Dashboard</a></li>
			<li><a href="#">Category Listings</a></li>
		</ol>
	</div>
</div>
<div class="row">
	<div class="col-xs-12">
		<div class="box">
			<div class="box-header">
				<div class="box-name">					
					<span>Category Listings</span>					
					<a href="{{Config::get('config.domain')}}category/add" style="float: right;padding-right:10px;"><button class="btn btn-primary" type="buttom">Add New</button></a>
				</div>
				
			</div>
			<div class="box-content no-padding">
					@if(Session::has('success'))
					    <div class="alert-box success">
					      <center> {{ Session::get('success') }}</center>
					    </div>
					@endif
					@if(Session::has('errMg'))
					    <div class="alert-box errMg">
					      <center> {{ Session::get('errMg') }}</center>
					    </div>
					@endif
				<table class="table table-bordered table-striped table-hover table-heading table-datatable" id="datatable-1">
					<thead>
						<tr>
							<th>ID</th>							
							<th>Category</th>
							<th>Posted Date</th>
							<th>Status</th>							
							<th>Action</th>
						</tr>
											
					</thead>
					<tbody>
					
					@foreach ($datas as $cat)
						<tr>
							<td>{{$cat->id}}</td>
							<td>{{ $cat->name }}</td>
							<td>{{ date("d-M-Y",strtotime($cat->created_at)) }}</td>
							<td >
								<ul class="status-option panel-menu">							
									<li class="dropdown">
										<a href="#" class="dropdown-toggle account" data-toggle="dropdown">
											{{ $allStatus[$cat->status] }}
											<span class="fa fa-angle-down"></span>											
										</a>
										<ul class="dropdown-menu">			
											@foreach($allStatus as $key=>$value)
											<li>
												<a href="{{Config::get('config.domain')}}category/changes/{{ $cat->id .'-'.$value}}">
													<span>{{$value}}</span>
												</a>
											</li>
											@endforeach
										</ul>
									</li>
								</ul>
							</td>
							<td>
								<a href="{{Config::get('config.domain')}}category/edit/{{$cat->id}}"><i class="fa fa-pencil-square-o"></i></a> 
								 
								<a href="javascript:confirmDelete('{{Config::get('config.domain')}}category/delete/{{$cat->id}}')">
									<span class="fa fa-trash-o" style="float:none"></span>
								</a>
							</td>
						</tr>
						
					 @endforeach	
					<!-- End: list_row -->
					</tbody>
				
				</table>

			</div>
		</div>
	</div>
   
	<div class="box-content" style="text-align: center">
		<div class="dataTables_paginate paging_bootstrap">
		 		 <?php echo $datas->appends(Input::except('page'))->links() ;?>
	 	</div>
	 </div>

</div>
<script type="text/javascript">
	function confirmDelete(delUrl){
		if (confirm("Are you sure to delete this item ?"))	{
			document.location = delUrl;
		}
	}
</script>
@stop